{include file="inc/header_other.html"}
<link href="css/common.css" rel="stylesheet"/>
<link href="css/nearby.css" rel="stylesheet"/>

<section class="sear re">
	<input type="text" value="搜索"/>
</section>

<section class="near">

{if $data.list}
	{foreach from=$data.list item=friend}
	<ul class="near1">
		<img class="pic fl" src="
		<?
		if(empty($this->_var['friend']['user_logo'])){
			echo $this->_var['friend']['avatar'];
		}else{
			echo $this->_var['friend']['user_logo'];;
		} 
		?>
		" alt=""/>
		<div class="cont fl">
			<h3>{$friend.user_name}</h3>
			<p class="info">
				<span>年龄：
				<?
				if(empty($this->_var['friend']['byear'])){
					echo '保密';
				}else{
					echo date("Y")-$this->_var['friend']['byear'];
					echo '岁';
				} 
				?>
				
				|</span>
				<span>性别：
				<?
				if($this->_var['friend']['sex']==1){
					echo '男';
				}elseif($this->_var['friend']['sex']==0){
					echo '女';		
				}else{
					echo '保密';
				} 
				?>
				</span>
			</p>
			<p class="state"><?php echo date("Y-m-d H:i:s",$this->_var['friend']['update_time']) ?></p>
		</div>
		<div><a class="add fr" id="add_friend_{$friend.id}" href="javascript:add_friend({$friend.id})">+</a></div>
	</ul>
	{/foreach}
{else}	
	暂无用户
{/if}		
	
</section>
<script src="js/jquery-1.6.2.min.js"></script>
<script>
/*加入购车事件*/
function add_friend(id){
    var id=id;
	$("#add_friend_"+id).attr("disabled",false);
	$("#add_friend_"+id).attr("style","background: #E2E2E2;");
	$.ajax({
		url: 'index.php?ctl=uc_msg&act=add_friend',
		type: 'POST',
		data: 'id=' + id + '&rnum=' + Math.random(),
		dataType: "json",
		success: function (data) {
			if(data.add_status==1){
				alert("添加成功，等待对方通过好友");
			}
			if(data.add_status==2){
				alert("你们已经是好友啦");
			}
			if(data.add_status==3){
				alert("等待对方通过好友");
			}
		},
		error: function () {
			alert("系统错误，请联系管理员");
		}
	});
}
</script>


